package com.gary.springcloud.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.gary.springcloud.handler.CustomerBlockHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author peng_rui
 * @date 2022/7/31
 */
@RestController
@RequestMapping(value = "/rate-limit")
public class RateLimitController {

    @SentinelResource(value = "byResource", blockHandlerClass = CustomerBlockHandler.class, blockHandler = "handler2")
    @RequestMapping(value = "/by-resource", method = RequestMethod.GET)
    public String byResource() {
        return "by-resource";
    }
}
